package com.situ.scientific.dao.impl;

import com.situ.scientific.dao.IFacultyDao;
import com.situ.scientific.pojo.Faculty;
import com.situ.scientific.pojo.Title;
import com.situ.scientific.util.JDBCUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

public class FacultyDaoImpl implements IFacultyDao {
    JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());
    @Override
    public List<Faculty> selectAll() {
        String sql = "SELECT id,name FROM faculty";
        return template.query(sql,new BeanPropertyRowMapper<>(Faculty.class));
    }
}
